//
//  LzwBniRecommendCell.m
//  CoJellyCartoon
//
//  Created by 刘志武 on 16/4/2.
//  Copyright © 2016年 CJG. All rights reserved.
//

#import "LzwBniRecommendCell.h"
#import <Masonry.h>

@interface LzwBniRecommendCell ()

@property (nonatomic, strong) UIImageView *myImageView;
@property (nonatomic, strong) UILabel *lableTitle;
@property (nonatomic, strong) UILabel *lableContent;

@end


@implementation LzwBniRecommendCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatViews];
    }
    
    return self;
}


- (void)creatViews{
    
    
    self.myImageView = [[UIImageView alloc]init];
    self.myImageView.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.myImageView];
    
    self.lableTitle = [[UILabel alloc]init];
    [self.contentView addSubview:self.lableTitle];
    
    self.lableContent = [[UILabel alloc]init];
    self.lableContent.textColor = [UIColor lightGrayColor];
    self.lableContent.numberOfLines = 0;
    self.lableContent.font = [UIFont systemFontOfSize:13];
    
    [self.contentView addSubview:self.lableContent];
    
    
//    [self.myImageView mas_makeConstraints:^(MASConstraintMaker *make) {
//        
//        make.top.equalTo(self.contentView).offset(10);
//        make.left.equalTo(self.contentView);
//        make.width.equalTo(self.contentView);
//        make.height.mas_equalTo(120);
//        
//    }];
//    
//    [self.lableTitle mas_makeConstraints:^(MASConstraintMaker *make) {
//        
//        
//        make.top.equalTo(self.myImageView.mas_bottom).offset(10);
//        make.left.equalTo(self.contentView).offset(10);
//        make.width.mas_equalTo(200);
//        make.height.mas_equalTo(20);
//        
//        
//    }];
//    
//    [self.lableContent mas_makeConstraints:^(MASConstraintMaker *make) {
//        
//        make.top.equalTo(self.lableTitle.mas_bottom).offset(5);
//        make.left.equalTo(self.contentView).offset(5);
//        make.width.equalTo(self.contentView).with.offset(-10);
//        make.height.mas_equalTo(_modleR.sizeFontHeiget);
//        
//    }];

}


-(void)setModleR:(LzwBniRecomModle *)modleR{
    _modleR = modleR;
    
    NSURL *url = [NSURL URLWithString:_modleR.cover];
    
    [self.myImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"zhanweiye"]];
    
    self.lableTitle.text = _modleR.title;
    
    self.lableContent.text = _modleR.desc;


}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.myImageView.frame = CGRectMake(0, 10, SCREEN_WIDTH, 120);
    self.lableTitle.frame = CGRectMake(10, CGRectGetMaxY(self.myImageView.frame), SCREEN_WIDTH - 20, 20);
    self.lableContent.frame = CGRectMake(10, CGRectGetMaxY(self.lableTitle.frame), SCREEN_WIDTH - 20, _modleR.sizeFontHeiget);
    
}



@end
